import sha256 from 'crypto-js/sha256';
export default {
    data () {
        return {
            formState:false,//弹框显示开关
        }
    },
    methods: {
        //弹出form框 ok方法
        ok () {
            this.$Message.info('Clicked ok');
        },
        //弹出form框 cancel方法
        cancel () {
            this.$Message.info('Clicked cancel');
        },
        //弹出form框 数据重置
        handleReset (name) {
            this.$refs[name].resetFields();
        },
        //弹出form框   数据新增&修改数据
        handleSubmit (name) {
            this.$refs[name].validate((valid) => {
                if (valid) {
                    //自定义保存数据方法
                    this.formValidate.password=sha256(this.formValidate.password).toString();
                    this.handleAxiosSubmit(name);
                } else {
                    this.handleSubmitIsFalse();
                }
            })
        },
        //handleSubmit方法中表单验证不通过的方法，默认
        handleSubmitIsFalse() {
            this.$Message.error('Fail!');
        },
    }
}